import request from '@/utils/request.js'

export const userRegisterService = ({ username, password, repassword }) =>
	request.post('/api/reg', { username, password, repassword })

export const userLoginService = ({ username, password }) =>
	request.post('/api/login', { username, password })

export const userInfoService = () => request.get('/my/userinfo')

// 获取用户基本信息
export const userInfoUpdateService = ({ id, nickname, email }) =>
	request.put('/my/userinfo', { id, nickname, email })

// 上传用户头像
export const userUploadAvatarService = avatar =>
	request.patch('/my/update/avatar', { avatar })

// 更新用户密码
export const userUpdatePasswordService = ({ old_pwd, new_pwd, re_pwd }) =>
	request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })
